package com.dpwgc.easywebpay.base.util;

import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 获取时间
 */
@Component
public class DateUtil {

    //获取当前时间
    public String getDateTime(){
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ");
        return sdf.format(date);
    }

    //获取延时时间
    public String getDateTimeLate(Long timeout){
        Long time = System.currentTimeMillis();
        time += timeout*1000;//在当前系统时间的基础上往后延长
        return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss ").format(time);
    }
}
